<template>
  <div class="toolbar">
    <h3 class="faxian">发现新菜</h3>
    <div class="sour" @click="go" 
    v-for="item of arr"
    :key="item.id"
    >
      <img :src="item.albums" alt />
      <p>{{item.title}}</p>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      arr:[]
    }
  },
  methods:{
    go(){
      this.$router.replace('/detail')
    }
  },
  mounted() {
    axios({
      url: "/json/cell.json",
    }).then(
       res=>res.data.reason ==="Success" && (this.arr = res.data.result.data)
      // res => console.log(res)
    );
  }
};
</script>

<style scoped>
.sour {
  overflow: hidden;
  height: auto;
  display: flex;
  align-items: center;
}
.faxian {
  text-align: left;
  margin-top: 20px;
}
img {
    display: block;
  width: 100px;
  margin-top: 10px;
}
p{
    margin-left: 30px;
}
</style>